<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<html>
   <head>
   	<link href="<%=request.getContextPath()%>/style/global.css" rel="stylesheet" type="text/css">
   	<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/javascript/common.js"></script>
   	<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/javascript/Ajax.js"></script>
   </head>

 <html:form action="/score" >
   <table border="0" align="center" width="100%">
       <tr>
           <td class="title">Math Problem Assessment - Scores</td>
       </tr> 
       <tr>
           <td>&nbsp;</td>
       </tr>
       <logic:equal name="aaform" property="displayScore" value="true">
       <tr>
           <td>
               <table border="1" width="85%" bordercolor="#cecde6" cellpadding="2" cellspacing="0">
                  <tr>
                     <td colspan="7">
                        <table>
                           <tr>
                              <td class="formLabel">Correct Answers: </td>
                              <td class="formValue"><bean:write name="aaform" property="score.correctQs"/></td>
                           </tr>
                           <tr>
                              <td class="formLabel">Wrong Answers: </td>
                              <td class="formValue"><bean:write name="aaform" property="score.wrongQs"/></td>
                           </tr>
                           <tr>
                              <td class="formLabel">Percentage: </td>
                              <td class="formValue"><bean:write name="aaform" property="score.percentage" format=""/>%</td>
                           </tr>      
                           <tr>
                              <td class="formLabel">Total Time Taken: </td>
                              <td class="formValue"><bean:write name="aaform" property="score.totalTime"/></td>
                           </tr>   
                        </table>
                     </td>
                  </tr>                
                  <tr>
                     <td class="tableHeader" width="7%" nowrap>Sum#</td>
                     <td class="tableHeader" width="30%">Sum</td>
                     <td class="tableHeader" width="10%" nowrap>Your Answer</td>
                     <td class="tableHeader" width="10%">Attempts</td>
                     <td class="tableHeader" width="8%">Answer</td>
                     <td class="tableHeader" width="10%">Score</td>
                     <td class="tableHeader" width="10%" nowrap>Time taken (sec)</td>
                  </tr>                  
                  <nested:iterate name="aaform" property="score.data" indexId="count1" type="java.util.List">
                  <nested:equal property="correctAnswer" value="true">
                  <tr>
                     <td class="correctdatarow" width="7%" nowrap><%=count1.intValue() + 1%></td>
                     <td class="correctdatarow" width="30%"><nested:write property="questionDesc" filter="false"/></td>
                     <td class="correctdatarow" width="10%" nowrap><nested:write property="useranswer"/></td>
                     <td class="correctdatarow" width="10%"><nested:write property="attempts"/></td>
                     <td class="correctdatarow" width="8%"><nested:write property="formattedAnswer"/></td>
                     <td class="correctdatarow" width="10%"><nested:write property="score"/></td>
                     <td class="correctdatarow" width="10%" nowrap><nested:write property="timeTaken"/></td>
                  </tr>
                  </nested:equal>
                  <nested:equal property="correctAnswer" value="false">
                  <tr>
                     <td class="wrongdatarow" width="7%" nowrap><%=count1.intValue() + 1%></td>
                     <td class="wrongdatarow" width="30%"><nested:write property="questionDesc"  filter="false"/></td>
                     <td class="wrongdatarow" width="10%" nowrap><nested:write property="useranswer"/> --> is wrong</td>
                     <td class="wrongdatarow" width="10%"><nested:write property="attempts"/></td>
                     <td class="wrongdatarow" width="8%"><nested:write property="answer"/></td>
                     <td class="wrongdatarow" width="10%">0</td>
                     <td class="wrongdatarow" width="10%" nowrap><nested:write property="timeTaken"/></td>
                  </tr>
                  </nested:equal>
                  </nested:iterate>
               </table>
           </td>
       </tr>
       </logic:equal>
       <logic:equal name="aaform" property="displayScore" value="false">
       <tr>
           <td class="subtitle">You did not attempt to answer any question. So, no score!</td>
       </tr>
       </logic:equal>
   </table>  
 </html:form>
</html>